<!-- 申请记录 -->
<template>
  <div class="all">
    <el-card>
      <el-table
        :data="tableData"
        style="width: 100%"
        border>
        <el-table-column
          prop="employerName"
          label="单位名称"
         >
        </el-table-column>

        <el-table-column
          prop="positionName"
          label="职位名称"
          >

        </el-table-column>

        <el-table-column
          prop="salary"
          label="薪资待遇">

        </el-table-column>

        <el-table-column
          prop="status"
          label="状态">

        </el-table-column>

      </el-table>
    </el-card>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pagination.current"
      :page-sizes="[5, 10]"
      :page-size="pagination.size"
      layout="total, sizes, prev, pager, next, jumper"
      :total="pagination.total"
      class="page"
    ></el-pagination>
  </div>



</template>

<script>
import {mapState} from "vuex";

export default {
  data() {
    return {
      tableData: [], //获取后端招聘信息
      pagination: { //分页
        current: 1, //当前页
        total: null, //记录条数
        size: 5 //每页条数
      },
    };
  },
  methods: {
    getInterviewInfo() { //分页查询所有招聘信息
      this.$axios({
        url:'/api/user/applyInfo',
        method:'get',
        params:{
          page:this.pagination.current,
          size:this.pagination.size,
          id:this.userInfo.Name
        },
        headers:{
          "Authorization":this.$cookies.get("token")
        }
      }).then(res =>{
        this.pagination=res.data.data
        this.tableData = res.data.data.records
        console.log(this.tableData)
      })
    },
    //改变当前记录条数
    handleSizeChange(val) {
      this.pagination.size = val
      this.getInterviewInfo()
    },
    //改变当前页码，重新发送请求
    handleCurrentChange(val) {
      this.pagination.current = val
      this.getInterviewInfo()
    },
  },
  created() {
    this.getInterviewInfo()
  },
  computed:mapState(["userInfo"])
};
</script>
<style lang="less" scoped>
.add {
  padding: 0px 40px;
  width: 400px;
}
.all {
  padding: 0px 40px;
  .page {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .edit {
    margin-left: 20px;
  }
  .el-table tr {
    background-color: #dd5862 !important;
  }
}
</style>

